package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import com.heima.wemedia.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/3/16 11:08
 * @Version 1.0
 */
@RestController
public class WmNewsController {

    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/api/v1/news/list")
    public PageResponseResult list(@RequestBody WmNewsPageReqDto reqDto) {
        return wmNewsService.pageList(reqDto);
    }

    @PostMapping("/api/v1/news/submit")
    public ResponseResult submit(@RequestBody WmNewsDto newsDto) {
        return wmNewsService.submit(newsDto);
    }

    @PostMapping("/api/v1/news/one/{id}")
    public ResponseResult one(@PathVariable Integer id) {
        return wmNewsService.getNewsOne(id);
    }

    @PostMapping("/api/v1/news/auth_fail")
    public ResponseResult authFail(@RequestBody WmNewsDto dto) {
        return wmNewsService.authFail(dto);
    }

    @PostMapping("/api/v1/news/auth_pass")
    public ResponseResult authPass(@RequestBody WmNewsDto dto) {
        return wmNewsService.authPass(dto);
    }
}